<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style>
      .gold{
        background-color: gold;
      }
      .green{
        background-color: rgb(134, 204, 43);
      }
      .circle{
        width: 100px;
        height: 100px;
        border-radius: 50%;
      }
      .blue{
        background-color: rgb(101, 101, 176);
      }
       
    </style>
    <title></title>
  </head>
  <body>
    <div id="app">  
     <button @click=show1>数组法class</button>
     <button @click=show2>对象法class</button>
     <div :class="obj"></div>
      <div :class="arr"></div>
    </div>
    <script src="./vue.js"></script>
    <script>
      const vm=new Vue({
        el:'#app',
        data:{
          obj:{
            gold:false,
            green:false,
            circle:false
          },
          arr:[]   
        },
        methods:{
          show1(){
            this.obj.gold=true
            this.obj.green=true
            this.obj.circle=true
          },
          show2(){
            this.arr.push("blue","circle")
          }
        },
       })
    </script>
  </body>
</html>